import fetch from '@/utils/request';

/**
 * 用户API对象
 * @module User
 */
const User = {
	/**
	 * @function get
	 * @description 得到登陆用户
	 */
	get: () => fetch.request({
		url: '/api/user/get',
		method: 'GET',
	}),
	/**
	 * @function updateName
	 * @description 修改用户名称
	 * @param  {String} name name
	 */
	updateName: (name) => fetch.request({
		url: '/api/user/update',
		method: 'POST',
		data: {
			name: name,
		}
	}),
	/**
	 * @function updateHeadimg
	 * @description 修改用户头像
	 * @param  {String} headimg headimg
	 */
	updateHeadimg: (headimg) => fetch.request({
		url: '/api/user/update',
		method: 'POST',
		data: {
			headimg: headimg,
		}
	}),
	/**
	 * @function logout
	 * @description 退出
	 */
	logout: () => fetch.request({
		url: '/api/user/logout',
		method: 'GET',
	}),
};
export default User;